<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="his_fns" uri="/WEB-INF/tlds/his_fns.tld" %>
<script type="text/javascript">
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#"   onclick="loadDiv('mainCenterDiv','${ctx}/drug/drugDetails/exportQue')">出库单据列表</a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="table-responsive no-border">
                    <div class="datatable-top">
                        <div class="pull-left">
                            <form:form id="searchForm" modelAttribute="drugExportDetail"  onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/drug/drugDetails/exportQue');" method="post" class="form-inline">
                                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                <div class="form-group"><label>药品名称:&nbsp;&nbsp;</label>
                                <form:input path="drugName" maxlength="50" class="form-control"></form:input></div>
                                入库日期:
                                <form:input path="updateDateStr" id ="startDate"  htmlEscape="false" class="form-control Wdate" onfocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" data-parsley-required="true"/>
                                至:<form:input path="createDateStr" id="stopDate"  htmlEscape="false" class="form-control Wdate" onfocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" data-parsley-required="true"/>

                                <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                <input id="btnPrint" class="btn btn-primary" type="submit" value="打印单据" />
                            </form:form>
                        </div>
                    </div>
                    <table id="contentTable" class="table table-bordered table-striped mg-t datatable">
                        <thead>
                        <tr>
                            <th>药品名称</th>
                            <th>包装数量</th>
                            <th>包装规格</th>
                            <th>包装单位</th>
                            <th>批号</th>
                            <th>有效期</th>
                            <th>出库价</th>
                            <%--<th>折扣</th>--%>
                            <th>出库数量</th>
                            <th>出库单号</th>
                            <th>出库时间</th>
                            <th>接受单位</th>

                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${page.list}" var="drugExportDetail">
                            <tr>
                                <td> ${drugExportDetail.drugName}</td>
                                <td> ${drugExportDetail.packageNum}</td>
                                <td> ${drugExportDetail.packageSpec}</td>
                                <td> ${fns:getDictLabels(drugExportDetail.packageUnits, 'SPEC_UNIT', '')}</td>
                                <td> ${drugExportDetail.batchNo}</td>
                                <td><fmt:formatDate value="${drugExportDetail.expireDate}" pattern="yyyy-MM-dd"/></td>
                                <td> ${drugExportDetail.purchasePrice}</td>
                                <%--<td> ${drugExportDetail.discount}</td>--%>
                                <td> ${drugExportDetail.quantity}</td>
                                <c:set var="drugExportMaster" value="${his_fns:getDrugExportMasterByMasterId(drugExportDetail.masterId)}"> </c:set>
                                <td> ${drugExportMaster.documentNo}</td>
                                <td> <fmt:formatDate value="${drugExportMaster.exportDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                <td> ${fns:getDeptName(drugExportMaster.receiver,"aa")}</td>


                            </tr>
                        </c:forEach>

                    </table>
                    <div class="pagination">${page}</div>
                </div>
            </div>
        </section>
    </div>
</div>
<script>
    $(function(){
        $("#btnPrint").click(function(){
            var drugName=$("#drugName").val();
            var startDate=$("#startDate").val();
            var stopDate=$("#stopDate").val();
            var remarks='1';
            printPdf('${ctx}/drug/drugDetails/drugExportDetailsPrint?drugName='+drugName+'&updateDateStr='+startDate+'&createDateStr'+stopDate+'&remarks='+remarks);
        })
    })
</script>